package com.edu.juc.lock.lockUpdate;

public class MonitorTest {
    static final Object o = new Object();
    static final Object o2 = new Object();

    public static void main(String[] args) {
        new Thread(MonitorTest::method).start();

        method2();
    }

    static void method() {
        synchronized (MonitorTest.class) {
            System.out.println("a");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("b");
        }
    }

    static void method2() {

        synchronized (o2) {
            System.out.println("A");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("B");
        }
    }
}
